import { _ as _export_sfc, z as ref, ao as onMounted, x as useMainStore, y as storeToRefs, O as watch, al as useNavbarHeight, A as computed, U as onShow, V as getStorageSync, T as onHide, B as onLoad, g as createElementBlock, b as createVNode, w as withCtx, n as normalizeStyle, H as unref, F as Fragment, j as resolveEasycom, i as index$g, G as __easycom_0, k as resolveDynamicComponent, o as openBlock, c as createBlock, e as createCommentVNode, t as createTextVNode, u as toDisplayString, p as index$q, ap as createBaseVNode, aq as index$7, ae as Input, Q as index$x, h as renderList, s as index$i, a1 as navigateTo, a5 as showLoading, a7 as hideLoading, a3 as showToast, ar as isWeixin, a6 as setStorageSync, I as switchTab, ak as getCurrentPages$1, ah as reLaunch, ag as navigateBack } from './index-Cc4oxzDN.js';
import { _ as __easycom_2, a as _imports_0 } from './list-cell.BHNnBKKp.js';
import { _ as __easycom_8 } from './modal._6MPzui9.js';
import { b as __easycom_5 } from './uv-toast.nS_Liirv.js';
import { d as debounce } from './debounce.7JT99E1S.js';
import { b as orderSubmit, p as payUnify } from './order.D8qtvuIN.js';
import { e as ensurePlatformId } from './platformId.BGlVpsd7.js';
import './uv-loading-icon.DuNkB54M.js';
import './platform.EIa5ETLd.js';

const _imports_1 = "/h5/static/images/pay/close.png";

// 延迟初始化 store

const _sfc_main = {
  __name: 'pay',
  setup(__props) {

let main = null;
const orderType = ref('takein');
const address = ref({});
const store = ref({});
const location = ref({});
const isLogin = ref(false);
const member = ref({});
const mycoupon = ref({});

// 在组件挂载后初始化 store
onMounted(() => {
  try {
    main = useMainStore();
    const storeRefs = storeToRefs(main);
    
    // 同步 store 数据到本地响应式变量
    orderType.value = storeRefs.orderType.value;
    address.value = storeRefs.address.value;
    store.value = storeRefs.store.value;
    location.value = storeRefs.location.value;
    isLogin.value = storeRefs.isLogin.value;
    member.value = storeRefs.member.value;
    mycoupon.value = storeRefs.mycoupon.value;
    
    // 监听 store 变化
    watch(storeRefs.address, (newAddress) => {
      address.value = newAddress;
    });
    
    watch(storeRefs.store, (newStore) => {
      store.value = newStore;
    });
    
    watch(storeRefs.member, (newMember) => {
      member.value = newMember;
    });
    
    watch(storeRefs.orderType, (newOrderType) => {
      orderType.value = newOrderType;
    });
    
    console.log('Store initialized successfully');
    console.log('Address data:', address.value);
    console.log('Store data:', store.value);
    console.log('Member data:', member.value);
    console.log('Order type:', orderType.value);
  } catch (error) {
    console.error('Error initializing store:', error);
  }
});
const active = ref(false);
const title = ref("支付");

// 获取导航栏高度
const { navbarHeightCss } = useNavbarHeight();
ref("");
const cart = ref([]);
const form = ref({
  remark: "",
});
ref(0);

const ensureAddressModalVisible = ref(false);
const takeoutTIme = ref(false); // 外卖取餐时间picker
ref({
  year: false,
  month: false,
  day: false,
  hour: true,
  minute: true,
  second: false,
});
const defaultTime = ref("00:00");
const takeinTIme = ref(false); // 到店自取时间selector
const takeinRange = ref([
  {
    name: "立即用餐",
    value: 0,
  },
  {
    name: "10分钟后",
    value: 10,
  },
  {
    name: "20分钟后",
    value: 20,
  },
  {
    name: "30分钟后",
    value: 30,
  },
  {
    name: "40分钟后",
    value: 40,
  },
  {
    name: "50分钟后",
    value: 50,
  },
]);
const defaultSelector = ref([0]);
const payType = ref("weixin"); // 付款方式
const coupons = ref(0); // 可用优惠券数量
const coupon = ref({}); // 选中的
const subscribeMss = ref({
  takein: "",
  takeout: "",
  takein_made: "",
  takeout_made: "",
}); // 微信订阅信息
const uToast = ref();

// 创建防抖函数
const debouncedSubmit = debounce(() => submit(), 500);
const debouncedPay = debounce(() => pay(), 500);

const total = computed(() => {
  return cart.value.reduce((acc, cur) => acc + cur.number * cur.price, 0);
});
const amount = computed(() => {
  let amount = cart.value.reduce((acc, cur) => acc + cur.number * cur.price, 0);
  // 加配送费
  if (
    store.value &&
    store.value.deliveryPrice !== undefined &&
    store.value.deliveryPrice !== null
  ) {
    amount += parseFloat(store.value.deliveryPrice);
  }

  // 减去优惠券
  if (mycoupon.value && mycoupon.value.hasOwnProperty("id")) {
    amount -= parseFloat(mycoupon.value.value);
  }
  return amount.toFixed(2);
});

onShow(() => {
  // 确保 store 已初始化后再获取数据
  if (main) {
    if (mycoupon.value) {
      coupon.value = mycoupon.value;
    }
    
    // 手动同步一次最新数据（防止 watch 没有触发）
    const storeRefs = storeToRefs(main);
    address.value = storeRefs.address.value;
    store.value = storeRefs.store.value;
    member.value = storeRefs.member.value;
    orderType.value = storeRefs.orderType.value;
    mycoupon.value = storeRefs.mycoupon.value;
  }
  
  let date = new Date(new Date().getTime() + 3600000); // 一个小时后
  let hour = date.getHours();
  let minute = date.getMinutes();
  if (hour < 10) {
    hour = "0" + hour;
  }
  if (minute < 10) {
    minute = "0" + minute;
  }
  defaultTime.value = hour + ":" + minute;

  console.log("member:", member.value);
  console.log("orderType =>", orderType.value);
  console.log("address =>", address.value);
  console.log("store =>", store.value);

  if (orderType.value == "takeout") {
    active.value = true;
  } else {
    active.value = false;
  }

  // getCoupons();

  let paytype = getStorageSync("paytype");
  payType.value = paytype ? paytype : "weixin";
});
onHide(() => {
  subscribeMss.value = [];
  coupons.value = 0;
});
onLoad((option) => {
  cart.value = getStorageSync("cart");
  if (option.remark) {
    form.value.remark = option.remark;
  }
  console.log("current orderType", orderType.value);
});
// 选择时间
const choiceTime = (e) => {
  defaultTime.value = e.detail.value;
  takeoutTIme.value = false;
};
const cancelTime = (e) => {
  takeoutTIme.value = false;
};
// 到店自取-选择取餐时间
const takeinConfirmTime = (e) => {
  defaultSelector.value = [e.detail.value];
};
const goToRemark = () => {
  navigateTo({
    url: "/pages/components/pages/remark/remark?remark=" + form.value.remark,
  });
};
const chooseAddress = () => {
  navigateTo({
    url: "/pages/components/pages/address/address?is_choose=true&scene=pay",
  });
};
const goToShop = () => {
  navigateTo({
    url: `/pages/components/pages/shop/shop`,
  });
};

// 导航栏左键点击事件
const $onClickLeft = () => {
  // 检查页面栈，如果是第一个页面则跳转到首页
  const pages = getCurrentPages$1();
  console.log('当前页面栈长度:', pages.length);
  
  if (pages.length <= 1) {
    // 如果是第一个页面，跳转到首页
    console.log('当前是第一个页面，跳转到首页');
    reLaunch({
      url: '/pages/index/index'
    });
  } else {
    // 有上一页，正常返回
    navigateBack({
      delta: 1,
      success: (res) => {
        console.log('返回上一页成功', res);
      },
      fail: (res) => {
        console.log('返回上一页失败', res);
        // 返回失败时也跳转到首页
        reLaunch({
          url: '/pages/index/index'
        });
      }
    });
  }
};
const submit = () => {
  // 需要配送地址的订单类型：外卖(takeout) 和 加盟商(franchisees)
  if (orderType.value == "takeout" || orderType.value == "franchisees") {
    // 检查是否选择了收货地址
    if (typeof address.value.id == "undefined" || !address.value.id) {
      uToast.value.show({
        message: "请选择收货地址",
        type: "error",
      });
      return;
    }

    // 外卖类型需要检查起送价
    if (orderType.value == "takeout" && store.value.min_price > total.value) {
      uToast.value.show({
        message: "本店外卖起送价为￥" + store.value.min_price,
        type: "error",
      });
      return;
    }

    pay();
  } else {
    // 其他类型（如 takein 到店自取）直接进入支付
    pay();
  }
};
const pay = async () => {



























  showLoading({
    title: "加载中",
  });

  // 最后一次地址验证（安全检查）
  if (orderType.value == "takeout" || orderType.value == "franchisees") {
    if (!address.value.id) {
      hideLoading();
      uToast.value.show({
        message: "请选择收货地址",
        type: "error",
      });
      return;
    }
  }

  let data = {
    orderType: orderType.value, // 购买类型:takein=自取,takeout=外卖
    addressId:
      orderType.value == "takeout" || orderType.value == "franchisees"
        ? address.value.id
        : 0, // 外卖配送地址
    shopId: store.value.id, // 店铺id
    mobile: member.value.mobile, // 联系电话
    gettime: takeinRange.value[defaultSelector.value[0]].value, // 取餐时间
    payType: payType.value, // 支付类型
    remark: form.value.remark, // 备注
    productId: [],
    spec: [],
    number: [],
    couponId: coupon.value.id ? coupon.value.id : 0, // 优惠券id
  };

  cart.value.forEach((item, index) => {
    data.productId.push(item.id);
    if (item.valueStr) {
      data.spec.push(item.valueStr?.replace(/,/g, "|"));
    }
    //data.spec.push(item.valueStr);
    data.number.push(item.number);
  });

  //console.log(data);
  let order = await orderSubmit(data);
  if (!order) {
    hideLoading();
    return;
  }
  console.log("order:", order);
  // 输出订单支付相关日志信息
  console.log("order.orderId:", order.orderId);
  console.log("payType.value:", payType.value);
  console.log("amount.value:", amount.value);
  
  // 支付前确保平台ID存在
  if (payType.value === "weixin" || payType.value === "alipay") {
    const hasPlatformId = await ensurePlatformId('payment');
    if (!hasPlatformId) {
      hideLoading();
      showToast({
        title: '需要授权后才能支付',
        icon: 'none'
      });
      return;
    }
  }
  
  // 增加延迟，确保订单创建事务已提交
  console.log("等待订单创建完成...");
  await new Promise(resolve => setTimeout(resolve, 1000));
  
  if (payType.value == "weixin") {
    // 微信支付
    weixinPay(order);
  } else if (payType.value == "yue") {
    // 余额支付
    balancePay(order);
  } else if (payType.value == "alipay") {
    // 支付宝支付
    await aliPayWithRetry(order);
  }
  hideLoading();
  return;
};
const balancePay = async (order) => {
  let from = "routine";
  let pay = await payUnify({
    uni: order.orderId,
    from: from,
    paytype: "yue",
  });

  hideLoading();
  if (!pay) {
    return;
  }

  member.value.money -= amount.value;
  if (main) {
    main.SET_MEMBER(member.value);
  }
  setStorageSync("cart", []);
  switchTab({
    url: "/pages/order/order",
    fail(res) {
      console.log(res);
    },
  });
};
const weixinPay = async (order) => {
  let from = "routine";

  from = "h5";
  if (isWeixin()) {
    from = "wechat";
  }


  //let that = this;
  let data = await payUnify({
    uni: order.orderId,
    from: from,
    paytype: "weixin",
  });
  console.log("wxpay result:", data);
  if (!data) {
    hideLoading();
    return;
  }
  if (data.trade_type == "MWEB") {

    // 微信外的H5
    console.log("data:", data);
    location.href = data.data;

    console.log("data1:", data);
  } else if (data.trade_type == "JSAPI") {
    console.log("param:", data);



















































  } else if (data.trade_type == "W-JSAPI") ; else if (data.trade_type == "APP") ;
};

// 带重试机制的支付宝支付方法
const aliPayWithRetry = async (order, retryCount = 0) => {
  const maxRetries = 2; // 最大重试次数
  
  try {
    await aliPay(order);
  } catch (error) {
    console.error(`支付宝支付失败 (尝试 ${retryCount + 1}/${maxRetries + 1}):`, error);
    
    // 如果是订单不存在的错误且还有重试次数
    if (error.message && error.message.includes('订单不存在') && retryCount < maxRetries) {
      console.log(`等待 ${(retryCount + 1) * 1000}ms 后重试...`);
      await new Promise(resolve => setTimeout(resolve, (retryCount + 1) * 1000));
      return await aliPayWithRetry(order, retryCount + 1);
    } else {
      // 重试次数用完或其他错误，直接抛出
      throw error;
    }
  }
};

const aliPay = async (order) => {
  console.log('开始支付宝支付流程');
  console.log('订单信息:', order);
  console.log('用户信息:', member.value);
  






























































































































































































  

  //let that = this;
  if (isWeixin()) {
    showToast({
      title: "请普通浏览器打开进行支付宝支付~",
      icon: "none",
    });
    return;
  }
  let h5Data = await payUnify({
    uni: order.orderId,
    from: "h5",
    paytype: "alipay",
  });

  console.log("data:", h5Data.data);
  // 支付宝支付，这里只要提交表单
  let form = h5Data.data;
  const div = document.createElement("formdiv");
  div.innerHTML = form;
  document.body.appendChild(div);
  //document.forms[0].setAttribute('target', ' self');
  document.forms[0].submit();
  //div.remove();

};

return (_ctx, _cache) => {
  const _component_uv_navbar = resolveEasycom(resolveDynamicComponent("uv-navbar"), __easycom_0);
  const _component_v_uni_view = index$g;
  const _component_v_uni_image = index$q;
  const _component_list_cell = resolveEasycom(resolveDynamicComponent("list-cell"), __easycom_2);
  const _component_v_uni_picker = index$7;
  const _component_v_uni_input = Input;
  const _component_v_uni_button = index$x;
  const _component_v_uni_text = index$i;
  const _component_modal = resolveEasycom(resolveDynamicComponent("modal"), __easycom_8);
  const _component_uv_toast = resolveEasycom(resolveDynamicComponent("uv-toast"), __easycom_5);

  return (openBlock(), createElementBlock(Fragment, null, [
    createVNode(_component_uv_navbar, {
      fixed: true,
      title: title.value,
      leftIcon: "arrow-left",
      onLeftClick: $onClickLeft
    }, null, 8, ["title"]),
    createVNode(_component_v_uni_view, {
      class: "container position-relative",
      style: normalizeStyle(`padding-top: ${unref(navbarHeightCss)};`)
    }, {
      default: withCtx(() => [
        createVNode(_component_v_uni_view, { style: {"margin-bottom":"130rpx"} }, {
          default: withCtx(() => [
            createVNode(_component_v_uni_view, { class: "section-1" }, {
              default: withCtx(() => [
                ('takeout' === orderType.value || 'franchisees' === orderType.value)
                  ? (openBlock(), createBlock(_component_list_cell, {
                      key: 0,
                      onClick: chooseAddress
                    }, {
                      default: withCtx(() => [
                        (address.value.realName)
                          ? (openBlock(), createBlock(_component_v_uni_view, {
                              key: 0,
                              class: "w-100 d-flex flex-column"
                            }, {
                              default: withCtx(() => [
                                createVNode(_component_v_uni_view, { class: "d-flex align-items-center justify-content-between mb-10" }, {
                                  default: withCtx(() => [
                                    createVNode(_component_v_uni_view, { class: "font-size-lg text-color-base" }, {
                                      default: withCtx(() => [
                                        createTextVNode(toDisplayString(address.value.address + " " + address.value.detail), 1)
                                      ]),
                                      _: 1
                                    }),
                                    createVNode(_component_v_uni_image, {
                                      src: _imports_0,
                                      class: "arrow"
                                    })
                                  ]),
                                  _: 1
                                }),
                                createVNode(_component_v_uni_view, { class: "d-flex text-color-assist font-size-sm align-items-center" }, {
                                  default: withCtx(() => [
                                    createVNode(_component_v_uni_view, { class: "mr-10" }, {
                                      default: withCtx(() => [
                                        createTextVNode(toDisplayString(address.value.realName), 1)
                                      ]),
                                      _: 1
                                    }),
                                    createVNode(_component_v_uni_view, null, {
                                      default: withCtx(() => [
                                        createTextVNode(toDisplayString(address.value.phone), 1)
                                      ]),
                                      _: 1
                                    })
                                  ]),
                                  _: 1
                                })
                              ]),
                              _: 1
                            }))
                          : (openBlock(), createBlock(_component_v_uni_view, {
                              key: 1,
                              class: "flex-fill d-flex justify-content-between align-items-center"
                            }, {
                              default: withCtx(() => [
                                createVNode(_component_v_uni_view, { class: "store-name flex-fill" }, {
                                  default: withCtx(() => [
                                    createTextVNode("选择收货地址")
                                  ]),
                                  _: 1
                                }),
                                createVNode(_component_v_uni_image, {
                                  src: _imports_0,
                                  class: "arrow"
                                })
                              ]),
                              _: 1
                            }))
                      ]),
                      _: 1
                    }))
                  : createCommentVNode("", true)
              ]),
              _: 1
            }),
            (orderType.value !== 'franchisees')
              ? (openBlock(), createBlock(_component_v_uni_view, {
                  key: 0,
                  class: "section-1"
                }, {
                  default: withCtx(() => [
                    createBaseVNode("template", null, [
                      (orderType.value === 'counter_ordering')
                        ? (openBlock(), createBlock(_component_list_cell, {
                            key: 0,
                            class: "location"
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_v_uni_view, { class: "flex-fill d-flex justify-content-between align-items-center" }, {
                                default: withCtx(() => [
                                  createVNode(_component_v_uni_view, { class: "store-name flex-fill" }, {
                                    default: withCtx(() => [
                                      createTextVNode(toDisplayString(store.value.name || ''), 1)
                                    ]),
                                    _: 1
                                  }),
                                  createVNode(_component_v_uni_image, {
                                    src: _imports_0,
                                    class: "arrow"
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }))
                        : (openBlock(), createBlock(_component_list_cell, {
                            key: 1,
                            class: "location",
                            onClick: goToShop
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_v_uni_view, { class: "flex-fill d-flex justify-content-between align-items-center" }, {
                                default: withCtx(() => [
                                  createVNode(_component_v_uni_view, { class: "store-name flex-fill" }, {
                                    default: withCtx(() => [
                                      createTextVNode(toDisplayString(store.value.name || ''), 1)
                                    ]),
                                    _: 1
                                  }),
                                  createVNode(_component_v_uni_image, {
                                    src: _imports_0,
                                    class: "arrow"
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }))
                    ]),
                    createBaseVNode("template", null, [
                      (orderType.value == 'takein')
                        ? (openBlock(), createBlock(_component_list_cell, {
                            key: 0,
                            arrow: "",
                            class: "meal-time"
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_v_uni_view, {
                                class: "flex-fill d-flex justify-content-between align-items-center",
                                onClick: _cache[0] || (_cache[0] = $event => (takeinTIme.value = !takeinTIme.value))
                              }, {
                                default: withCtx(() => [
                                  createVNode(_component_v_uni_view, { class: "title" }, {
                                    default: withCtx(() => [
                                      createTextVNode("取餐时间")
                                    ]),
                                    _: 1
                                  }),
                                  createVNode(_component_v_uni_view, { class: "time" }, {
                                    default: withCtx(() => [
                                      createVNode(_component_v_uni_picker, {
                                        range: takeinRange.value,
                                        "range-key": "name",
                                        onChange: takeinConfirmTime
                                      }, {
                                        default: withCtx(() => [
                                          createVNode(_component_v_uni_view, { class: "picker" }, {
                                            default: withCtx(() => [
                                              createTextVNode(toDisplayString(takeinRange.value[defaultSelector.value[0]]?.name || '立即用餐'), 1)
                                            ]),
                                            _: 1
                                          })
                                        ]),
                                        _: 1
                                      }, 8, ["range"])
                                    ]),
                                    _: 1
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }))
                        : createCommentVNode("", true),
                      (orderType.value == 'takein')
                        ? (openBlock(), createBlock(_component_list_cell, {
                            key: 1,
                            class: "contact",
                            last: "",
                            hover: false
                          }, {
                            default: withCtx(() => [
                              createVNode(_component_v_uni_view, { class: "flex-fill d-flex justify-content-between align-items-center" }, {
                                default: withCtx(() => [
                                  createVNode(_component_v_uni_view, { class: "title flex-fill" }, {
                                    default: withCtx(() => [
                                      createTextVNode("联系电话")
                                    ]),
                                    _: 1
                                  }),
                                  createVNode(_component_v_uni_view, { class: "time" }, {
                                    default: withCtx(() => [
                                      createVNode(_component_v_uni_input, {
                                        class: "text-right",
                                        placeholder: "请输入手机号码",
                                        value: member.value.mobile || ''
                                      }, null, 8, ["value"])
                                    ]),
                                    _: 1
                                  }),
                                  createVNode(_component_v_uni_button, { class: "contact-tip font-size-sm" }, {
                                    default: withCtx(() => [
                                      createTextVNode("自动填写")
                                    ]),
                                    _: 1
                                  })
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }))
                        : createCommentVNode("", true)
                    ]),
                    (orderType.value == 'takeout')
                      ? (openBlock(), createBlock(_component_list_cell, { key: 0 }, {
                          default: withCtx(() => [
                            createVNode(_component_v_uni_view, { class: "w-100 d-flex flex-column" }, {
                              default: withCtx(() => [
                                createVNode(_component_v_uni_view, { class: "d-flex align-items-center font-size-base text-color-base" }, {
                                  default: withCtx(() => [
                                    createVNode(_component_v_uni_view, { class: "flex-fill" }, {
                                      default: withCtx(() => [
                                        createTextVNode("预计送达时间")
                                      ]),
                                      _: 1
                                    }),
                                    createVNode(_component_v_uni_view, { class: "mr-10" }, {
                                      default: withCtx(() => [
                                        createVNode(_component_v_uni_picker, {
                                          mode: "time",
                                          onChange: choiceTime,
                                          onCancel: cancelTime
                                        }, {
                                          default: withCtx(() => [
                                            createVNode(_component_v_uni_view, { class: "picker" }, {
                                              default: withCtx(() => [
                                                createTextVNode(toDisplayString(defaultTime.value), 1)
                                              ]),
                                              _: 1
                                            })
                                          ]),
                                          _: 1
                                        })
                                      ]),
                                      _: 1
                                    })
                                  ]),
                                  _: 1
                                })
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        }))
                      : createCommentVNode("", true)
                  ]),
                  _: 1
                }))
              : createCommentVNode("", true),
            createVNode(_component_v_uni_view, { class: "section-2" }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "cart d-flex flex-column" }, {
                  default: withCtx(() => [
                    (openBlock(true), createElementBlock(Fragment, null, renderList(cart.value, (item, index) => {
                      return (openBlock(), createBlock(_component_list_cell, {
                        last: "",
                        key: index
                      }, {
                        default: withCtx(() => [
                          createVNode(_component_v_uni_view, { class: "w-100 d-flex flex-column" }, {
                            default: withCtx(() => [
                              createVNode(_component_v_uni_view, { class: "d-flex align-items-center mb-10" }, {
                                default: withCtx(() => [
                                  createVNode(_component_v_uni_view, { class: "d-flex flex-fill justify-content-between align-items-center text-color-base font-size-lg" }, {
                                    default: withCtx(() => [
                                      createVNode(_component_v_uni_image, {
                                        style: {"width":"80rpx","height":"80rpx"},
                                        mode: "aspectFill",
                                        src: item.image
                                      }, null, 8, ["src"])
                                    ]),
                                    _: 2
                                  }, 1024),
                                  createVNode(_component_v_uni_view, { class: "name-and-props overflow-hidden" }, {
                                    default: withCtx(() => [
                                      createVNode(_component_v_uni_view, { class: "text-color-base font-size-lg" }, {
                                        default: withCtx(() => [
                                          createTextVNode(toDisplayString(item.name), 1)
                                        ]),
                                        _: 2
                                      }, 1024)
                                    ]),
                                    _: 2
                                  }, 1024),
                                  createVNode(_component_v_uni_view, { class: "d-flex flex-fill justify-content-between align-items-center text-color-base font-size-lg" }, {
                                    default: withCtx(() => [
                                      createVNode(_component_v_uni_view, null, {
                                        default: withCtx(() => [
                                          createTextVNode("x" + toDisplayString(item.number), 1)
                                        ]),
                                        _: 2
                                      }, 1024),
                                      createVNode(_component_v_uni_view, null, {
                                        default: withCtx(() => [
                                          createTextVNode("￥" + toDisplayString(item.price), 1)
                                        ]),
                                        _: 2
                                      }, 1024)
                                    ]),
                                    _: 2
                                  }, 1024)
                                ]),
                                _: 2
                              }, 1024),
                              createVNode(_component_v_uni_view, { class: "text-truncate font-size-base text-color-assist" }, {
                                default: withCtx(() => [
                                  createTextVNode(toDisplayString(item.valueStr), 1)
                                ]),
                                _: 2
                              }, 1024)
                            ]),
                            _: 2
                          }, 1024)
                        ]),
                        _: 2
                      }, 1024))
                    }), 128))
                  ]),
                  _: 1
                }),
                createVNode(_component_list_cell, { last: "" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "flex-fill d-flex justify-content-end align-items-center" }, {
                      default: withCtx(() => [
                        createVNode(_component_v_uni_view, null, {
                          default: withCtx(() => [
                            createTextVNode(" 总计￥" + toDisplayString(total.value) + " ", 1),
                            (orderType.value == 'takeout')
                              ? (openBlock(), createBlock(_component_v_uni_text, { key: 0 }, {
                                  default: withCtx(() => [
                                    createTextVNode(",配送费￥" + toDisplayString(store.value.deliveryPrice || 0), 1)
                                  ]),
                                  _: 1
                                }))
                              : createCommentVNode("", true),
                            (coupon.value.value)
                              ? (openBlock(), createBlock(_component_v_uni_text, { key: 1 }, {
                                  default: withCtx(() => [
                                    createTextVNode(",￥-" + toDisplayString(coupon.value.value), 1)
                                  ]),
                                  _: 1
                                }))
                              : createCommentVNode("", true),
                            createTextVNode(" ,实付 ")
                          ]),
                          _: 1
                        }),
                        createVNode(_component_v_uni_view, { class: "font-size-extra-lg font-weight-bold" }, {
                          default: withCtx(() => [
                            createTextVNode("￥" + toDisplayString(amount.value), 1)
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_v_uni_view, {
              class: "d-flex align-items-center justify-content-start font-size-sm text-color-warning",
              style: {"padding":"20rpx 0"}
            }),
            createVNode(_component_v_uni_view, { class: "payment" }, {
              default: withCtx(() => [
                createVNode(_component_list_cell, {
                  last: "",
                  hover: false
                }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_text, null, {
                      default: withCtx(() => [
                        createTextVNode("支付方式")
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(_component_list_cell, {
              last: "",
              onClick: goToRemark
            }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, {
                  class: "d-flex flex-fill align-items-center justify-content-between overflow-hidden",
                  style: {"margin-bottom":"110rpx"}
                }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "flex-shrink-0 mr-20" }, {
                      default: withCtx(() => [
                        createTextVNode("备注")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, { class: "text-color-primary flex-fill text-truncate text-right" }, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(form.value.remark || "点击填写备注"), 1)
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        createVNode(_component_v_uni_view, {
          style: {"z-index":"1"},
          class: "w-100 pay-box position-fixed fixed-bottom d-flex align-items-center justify-content-between bg-white"
        }, {
          default: withCtx(() => [
            createVNode(_component_v_uni_view, {
              class: "font-size-sm",
              style: {"margin-left":"20rpx"}
            }, {
              default: withCtx(() => [
                createTextVNode("合计：")
              ]),
              _: 1
            }),
            createVNode(_component_v_uni_view, { class: "font-size-lg flex-fill" }, {
              default: withCtx(() => [
                createTextVNode("￥" + toDisplayString(amount.value), 1)
              ]),
              _: 1
            }),
            createVNode(_component_v_uni_view, {
              class: "bg-primary h-100 d-flex align-items-center just-content-center text-color-white font-size-base",
              style: {"padding":"0 60rpx"},
              onClick: unref(debouncedSubmit)
            }, {
              default: withCtx(() => [
                createTextVNode("付款 ")
              ]),
              _: 1
            }, 8, ["onClick"])
          ]),
          _: 1
        }),
        createVNode(_component_modal, {
          show: ensureAddressModalVisible.value,
          custom: "",
          "mask-closable": false,
          radius: '0rpx',
          width: "90%"
        }, {
          default: withCtx(() => [
            createVNode(_component_v_uni_view, { class: "modal-content" }, {
              default: withCtx(() => [
                createVNode(_component_v_uni_view, { class: "d-flex justify-content-end" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_image, {
                      src: _imports_1,
                      style: {"width":"40rpx","height":"40rpx"},
                      onClick: _cache[1] || (_cache[1] = $event => (ensureAddressModalVisible.value = false))
                    })
                  ]),
                  _: 1
                }),
                createVNode(_component_v_uni_view, {
                  class: "d-flex just-content-center align-items-center",
                  style: {"margin-bottom":"40px"}
                }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { class: "font-size-extra-lg text-color-base" }, {
                      default: withCtx(() => [
                        createTextVNode("请再次确认下单地址")
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                createVNode(_component_v_uni_view, { class: "d-flex font-size-base text-color-base font-weight-bold align-items-center justify-content-between mb-20" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, null, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(address.value.realName), 1)
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_view, null, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(address.value.phone), 1)
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                createVNode(_component_v_uni_view, { class: "d-flex font-size-sm text-color-assist align-items-center justify-content-between mb-40" }, {
                  default: withCtx(() => [
                    createVNode(_component_v_uni_view, { style: {"max-width":"60%"} }, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(address.value.address + address.value.detail), 1)
                      ]),
                      _: 1
                    }),
                    createVNode(_component_v_uni_button, {
                      type: "primary",
                      size: "min",
                      plain: "",
                      class: "change-address-btn",
                      style: {"white-space":"nowrap"},
                      onClick: chooseAddress
                    }, {
                      default: withCtx(() => [
                        createTextVNode(" 修改地址 ")
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                createVNode(_component_v_uni_button, {
                  type: "primary",
                  class: "pay_btn",
                  onClick: unref(debouncedPay)
                }, {
                  default: withCtx(() => [
                    createTextVNode(" 确认并付款 ")
                  ]),
                  _: 1
                }, 8, ["onClick"])
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["show"]),
        createVNode(_component_uv_toast, {
          ref_key: "uToast",
          ref: uToast
        }, null, 512)
      ]),
      _: 1
    }, 8, ["style"])
  ], 64))
}
}

};
const pay = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-5f05a67e"]]);

export { pay as default };
